﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using chessLogic;

namespace chessView
{
    public partial class BoardForm : Form
    {
        private Drawer drawer;
        private Figure figure;

        public BoardForm(Figure _figure)
        {
            InitializeComponent();
            drawer = new Drawer();
            figure = _figure;
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ChessPanel_Paint(object sender, PaintEventArgs e)
        {
            drawer.DrawBoard(e.Graphics);
            drawer.DrawFigure(figure, new Position(figure.MovesMaked.Last<string>()), e.Graphics);
            for (int i = 1; i < figure.MovesMaked.Count; i++)
            {
                drawer.DrawPointer(e.Graphics, new Position(figure.MovesMaked[i - 1]), new Position(figure.MovesMaked[i]), i);
            }
        }
    }
}
